﻿<%@ Page Language="C#" MasterPageFile="~/HomePages.Master" AutoEventWireup="true" CodeBehind="AccountManager.aspx.cs" Inherits="BusinessService.AccountManager" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
 <link href="../Content/MyMap.css" rel="stylesheet" type="text/css" />
 <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
 <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>My Place</title>
<script src="../Scripts/MyGoogleMap.js" type="text/javascript"></script>
<script src="../Content/BusinessService.js" type="text/javascript"></script>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script src="../Content/PlaceSearch.js" type="text/javascript"></script>
 <script src="../Content/js/util.js" type="text/javascript"></script>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false&libraries=places"></script>
<%--<script src="http://www.google.com/uds/api?file=uds.js&amp;v=1.0&amp;key=ABQIAAAAjU0EJWnWPMv7oQ-jjS7dYxQ82LsCgTSsdpNEnBsExtoeJv4cdBSUkiLH6ntmAr_5O4EfjDwOa0oZBQ" type="text/javascript"></script>--%>
<script type="text/javascript">
  
  var map, places, iw;
  var markers = [];
  var autocomplete; 
  var geocoder;
   var markerInsert = new google.maps.Marker();
  var infoWindowInsert = new google.maps.InfoWindow();
  
  
  function initialize() {
  geocoder = new google.maps.Geocoder();
    var myLatlng = new google.maps.LatLng(37.783259, -122.402708);
    var myOptions = {
      zoom: 12,
      center: myLatlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    }
    map = new google.maps.Map(document.getElementById("map"), myOptions);
    places = new google.maps.places.PlacesService(map);
    google.maps.event.addListener(map, 'tilesloaded', tilesLoaded);
    autocomplete = new google.maps.places.Autocomplete(document.getElementById('txtSearch'));
    google.maps.event.addListener(autocomplete, 'place_changed', function() {
      showSelectedPlace();
    });
    
      google.maps.event.addListener(map, "click", function(event) {
//    document.getElementById("txtSearch").value = event.latLng.toUrlValue(6);
//    codeLatLng();
//        marker = new google.maps.Marker({
//          position: event.latLng,
//          map: map
//        });
    markerInsert.setPosition(event.latLng);
    markerInsert.setMap(map);
        
       var latLngs = event.latLng;
       var address;  
  geocoder.geocode({'latLng': latLngs}, function(results, status) {
      if (status == google.maps.GeocoderStatus.OK) {
         if (results[1]) {
            address = results[1].formatted_address;
          }
       }
//      var options = getDichVu();
     var html = gethtml(address);
     infoWindowInsert.setPosition(latLngs);
     infoWindowInsert.setContent(html);      
       
    });
 
    
    google.maps.event.addListener(markerInsert, "click", function() {   
    
          infoWindowInsert.open(map, markerInsert);
        });
    });      
    


  }  

</script>
<style type="text/css">
.placeIcon {
  width: 32px;
  height: 32px;
  margin: 5px;
}
#results {
  font-size: 12px;
  border-collapse: collapse;
}
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<div id="left"  style=" cursor: pointer; overflow:scroll;">
   <div id="feature" align="center" style="overflow:hidden; margin: 10px 1px 10px 1px;">
       <input id="btnMyPlace" name="btnMyPlace" type="button" value="Vị Trí Của Bạn" style="width:150px;" />
        <input id="btnManager" name="btnManager" type="submit" value="Quản Lý Địa Điểm" style="width:150px;" />
   </div>
   <table id="results"></table>  
   <div id="resultsearch" style="overflow:hidden; width:100%;"></div> 
</div>
 <!-- main map-->
<div id="map">
</div> 
</asp:Content>
